Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MapLibre 4 custom modifications #2

Closed
wants to merge 1,120 commits into from
Closed

Conversation

patrikschiller
Copy link
Collaborator

@patrikschiller patrikschiller commented Oct 1, 2024

Added custom features that were not part of the main branch such as:

  • latitude bounds
    • constrain map movement over certain latitude bounds
  • support for texture formats other than gl.RGBA used by raster tile sources
    • developer can define texture format (both wgl1 and wgl2) used for tile textures (overrides default gl.RGBA) used by raster sources (sourceCache)
  • exports for Event, Tile, SourceCache, and OverscaledTileID
    • required for our renderer development

Launch Checklist

  • Confirm your changes do not include backports from Mapbox projects (unless with compliant license) - if you are not sure about this, please ask!
  • Briefly describe the changes in this PR.
  • Link to related issues.
  • Include before/after visuals or gifs if this PR includes visual changes.
  • Write tests for all new functionality.
  • Document any changes to public APIs.
  • Post benchmark scores.
  • Add an entry to CHANGELOG.md under the ## main section.

kubapelc and others added 30 commits July 11, 2024 14:16
* Delete unused file

* Rename projection.name to projection.projectionName

Since this interface will be implemented by the transfrom class soon

* Symbols: displayed collision circles now exactly match their computed positions

* Globe: use mercator projection for symbol placement when globe rendering is disabled

* Group all getters/setters in the transform class

* Transform: move transform-related stuff from the projection interface to transform class

(WIP)

* Transform: finish moving parts of projection into mercator_transform.ts

* Transform: remove posMatrix usage from line symbol placement

(WIP)

* Transform: temporarily remove globe stuff

(WIP, compilable)

* Transform: fix line symbols

* Symbols: fix wrong function names

* Fix line point projections

* Fix line rendering

Some things are still broken

* Fix line symbols sometimes being incorrectly oriented

* Fix some failing unit tests

* Fix single glyph orientation

* Add another image to render test

No idea why it is shifted by a few pixels but I assume that the new expected image is also correct

* Add another expected image to textFit-grid-long test

It was only failing on my machine, works fine in github CI windows tests

* Fix some failing unit tests

* Simplify getProjectionData interface and terrain matrix passing

* Change comment at calculatePosMatrix

* Fix symbols not rendering, remove unused shader parameters

* Bring back globe src files

* globe.test.ts is now globe_transform.test.ts

* Move stuff from globe.ts to globe_transform.ts

* Fix showTileBoundaries not working

Fix the three render tests related to showTileBoundaries timing out.

* Remove irrelevant test

* Fix failing unit test

* Transform: move more stuff from globe to globe_transform

* Transform: better comments

* Transfrom: isRenderingDirty cleanup

* Transform: no more errors in globe_transform.ts

* Transform: remove `get point()` from transform class

* Transform: globe_transform.ts is compilable

* Re-enable globe projection

* Fix source_cache.ts sometimes crashing

* Fix globe.ts - globe_transform.ts circular dependency

* Fix and refactor getProjectionData interface

Now it is actually compilable, with many bugs

* Transform: fix failing unit tests

* Transform: fix symbols not rendering on globe

* Transform: minor fixes

* Transform: update globe symbol render tests

* Transform: unify how symbol/projection.ts exports stuff

* Transform: improve comments

* Remove unused function in painter

* Transform: cleanup unneeded abstract functions

* Transform: replace abstract getHorizon function with more generic isPointOnMapSurface function

* Fix useGlobeRendering not being set properly

* Transform: proper implementation of isPointOnMapSurface and screen pixel unprojection for globe

* Transform: adapt more functions for globe

* Transform: fix locationPoint implementation

* Controls: globe panning experiments

* Controls: reasonable globe panning

* Controls: centering zoom for globe experiment

* Transform: fix globe unit tests

* Transform: fix remaining unit tests

* Move mercator_transform.test to src/geo/projection

* Transform: globe bugfixes and more unit tests

* Transform: bugfix globe setLocationAtPoint

* Transform: isolate accesses to globe projection to avoid unintentional transform's state changes

* Transform: move related tests so they are near each other

* Transform: improve globe unprojection accuracy

* Transform: fix globe bugs

* Transform: move globe unit tests

* Transform: another globe setLocationAtPoint implementation

* Transform: fix globe zoom adjustment not working

* Transform: fix setLocationAtPoint

* Transform: setLocationAtPoint and zoom WIP

* Transform: adjust unit test to accept positive longitudes

* Transform: improve globe math precision (fp64)

* Transform: precision improvement, better camera position

* Transform: another test WIP

* Transform: fix setLocationAtPoint condition

* Transform: more reasonable zoom for globe

Still has bugs though

* Transform: globe zoom works well when cursor is outside the globe

* Transform: globe more consistent zoom logic

* Transform: experimental pole edge clamp for globe

* Transform: fix maxLatitudeForZoomLevel math

* Transform: globe constrain experiment

* Transform: minor improvements

* Transform: globe panning 2.0

* Transform: globe panning 2.1

Adjust more constants!

* Transform: some math for globe zoom

* Transform: globe: working zoom controls without glitches

* Transform: globe zoom: fix some more glitching

* Transform: globe zoom: reduce panning when zoom pixel is far from the planet

* Transform: zoom globe: simplify, better behaviour around poles

* Transform: globe zoom: exact zooming

* Transform: globe zoom: better comments

* Transform: temporarily disable camera easeTo and flyTo

* Transform: calling project/unproject on a globe should fail, rename project/unproject to be more descriptive

* Transform: fitBounds: initial implementation for globe_transform

Not working

* Transform: fitBounds: zoom is now correct

* Transform: fitBounds: padding works for north/south

* Transform: fitBounds: just build on top of mercator code

* Transform: fitBounds: the original way

* Transform: fitBounds: back to mercator-buildon + done

* Transform: tighter bounds for zoom heuristic transition

* Transform: easeTo: probably works

* Transform: attempt to handle camera options apparent zoom for globe

* Transform: easeTo fixes WIP

* Transform: easeTo: mostly working implementation (still WIP)

* Transform: easeTo: small fixes

* Transform: easeTo: intertia works for panning

* Transform: globe zoom: add globe radius based slowing factor

* Transform: globe zoom adjustments

* Transform: jumpTo adapted for globe

* Transform: camera flyTo works for globe

* Make (un)projectToWorldCoordinates into standalone functions

* Fix inertia sometimes rotating in the wrong direction

* Fix transform center sometimes not getting wrapped, leading to visual artifacts

* Transform: easeTo: slerp experiment

* Transform: easeTo: revert slerp, add note on why it is not used

* Transform: improve center animation for easeTo and flyTo

* Minor refactor & remove some outdated TODOs

* More refactor and TODOs

* Transform: globe remembers its globeness state after clone, fixes improper collision box when globe gets soft-disabled

* Terrain matrix refactor WIP

* Terrain fixes

* Transform: better comments, rename angularCoordinatesToVector to angularCoordinatesToSurfaceVector, some functions for globe WIP

* Transform: getBounds for globe works

* Transform: remove some comments

* Fix merge

* Remove globe.test.ts (it is now globe_transform.test.ts)

* Rename Transform.updateProjection to newFrameUpdate

* Revert globe.ts to pre-merge state

* Revert mercator.ts to pre-merge state

* New mechanism for creating specialized transforms, more merge fixes

* Rename projectionMatrix to modelViewProjectionMatrix, refactor mercator_transform.ts a bit

* More merge fixes, minor refactor of transforms

* Add transform getters for atmosphere

* Fix forgotten useGlobeControls uses

* Fix cyclical dependency

* Fix tests

* Fix crashes

* Fix manually triggered globe transition animation

* Fix collision boxes not respecting mercator transition

* Blend out atmosphere when transitioning to mercator

* Fix globe transitions when mercator should be constrained

* Reload all tiles upon projection change

* Fix failing style tests

* Fix terrain source cache tests

* Fix map zoom&center being applied in wrong order, causing zoom to be wrongly constrained under globe

* Update globe pole render tests with correct zoom

* Update globe unit test zooms

* Fix more unit tests

* Fix transform.apply not copying everything, fix globe controls not wrapping longitudes

* Fix some globe tests

* Fix globe setLocationAtPoint

* Fix docs & lint

* Increase globe setLocationAtPoint test desired precision

* Some camera tests for globe

* Fix easeTo test suite name and placing

* Add rotated setLocationAtPoint test for globe, fix failing test

* Fix globe easeTo & flyTo with bearing to follow spec, add tests

* easeTo globe tests

* All relevant camera tests for globe implemented

* Update build size test

* Fix symbols not respecting mercator

* Update build size again

* Terrain fix

* Fix merge

* Fix terrain shaders

* Fix merge

* Revert controls changes

* Fix reverted files

* Fix reverted camera tests

* Revert forgotten file, fix lint

* Update build size

* Feedback comments for unit tests

* Convert setters to functions: runtime code

* Convert setters to functions: test code

* Convert last setter to function

* Fix some tests

* Transform is now an interface

* Rename Transform to ITransform

* Remove abstract functions from transform base class

* TransformHelper wip

* Rename transform files

* Finish transform rewrite

* Fix mercator transform tests

* Fix mercator_transform constructor

* Fix symbol bucket test

* Fix source cache tests

* Fix transform clone bug & tests

* Improve comments

* More comments

* Fix import

* Move helper functions in tests to beginning of file

* Fix collision index test accessing a private field

* Remove unneeded null check

* New utils tests + quadratic solve fix

* Add remapSaturate tests

* Add explicit types to line glyph placement

* Refactor placeGlyphsAlongLine args into an object

* Fix merge, cleanup draw_custom.test, fix missing perspective offset in globe transform

* Fix draw_custom test

* Update build test

* Fix crashes

* Fix transform_helper apply function not setting bearing correctly

* Add test for TransformHelper

* Fix TransformHelper.apply

* Fix flipped text placement

* Add new expected image to render test

* Fix marker tests

* Update build size

* Move functions from mercator_transform.ts to mercator_utils.ts

* Refactor un/projectToWorldCoordinates function args

* Make zoomScale and scaleZoom standalone functions

* Fix unprojectFromWorldCoordinates arg type

* Move globe functions to separate file

* Fix private member access in source_cache.test.ts

* Fix deck.gl missing dot

* Fix missing globe_utils.ts

* Better `angleToRotateBetweenVectors2D` doccomment

* Remove unneeded `protected`

* Cleanup transform interface and remove duplicate comments

* Split mercator_utils tests into a separate file

* Fix tests

* Split globe locationPoint tests a bit

* Add more mercator tests

* More globe tests

* Fix globe getBounds and add tests for it

* Remove unneeded function, update build size

* projectTileCoordinates for globe now covered by test

* Add globe_utils tests

* Split up globe tests more

* Fix missing doccomment

* Rename transform's projection/unprojection functions

* Better ray intersection comment and type

* Reduce indentation

* Improve unproject math readability

* Add point-plane distance util function

* Move tileCoordinatesToMercatorCoordinates to mercator_utils

* Better name for location to mercator coordinate functions

* Move angleToRotateBetweenVectors2D to utils

* Refactor _globeness usage

* Remove _initialized from GlobeTransform

* Remove translatePosition from transform interface

* Add IReadonlyTransform interface

* Update build size

* Remove unneeded comment
# Conflicts:
#	src/geo/transform_interface.ts
#	src/ui/camera.ts
#	src/ui/handler/scroll_zoom.ts
#	src/ui/handler_manager.ts
# Conflicts:
#	src/geo/projection/globe_transform.ts
#	src/geo/projection/mercator_transform.ts
#	src/render/draw_custom.ts
#	src/ui/camera.test.ts
#	src/ui/camera.ts
#	src/ui/handler/scroll_zoom.ts
#	src/ui/handler_manager.ts
@patrikschiller patrikschiller added the enhancement New feature or request label Oct 1, 2024
@patrikschiller
Copy link
Collaborator Author

Old PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants